/**
 * File: StatisticsInfo.java
 * Created by: mhaimel
 * Created on: 31 Mar 2009
 * CVS:  $Id: StatisticsInfo.java,v 1.4 2009/11/24 15:51:38 mhaimel Exp $
 */
package uk.ac.ebi.velvet.processor;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;


/**
 * @author mhaimel
 *
 */
public class StatisticsInfo {
	private Integer n50 = null;
	private Integer expCov = null;
	private Integer cutoffCov = null;
	private Integer minLength = null;
	private Integer maxLength = null;
	private Integer coverageOfMaxLength = null;
	private Long totalLength = null;
	private Integer nContigs = null;
	
	public StatisticsInfo() {
	}
	
	public StatisticsInfo(Integer expCov, Integer cutoffCov, Integer max,Integer n50, Long totalLength, Integer coverageOfMaxLength) {
		super();
		this.expCov = expCov;
		this.cutoffCov = cutoffCov;
		this.maxLength = max;
		this.n50 = n50;
		this.totalLength = totalLength;
		this.coverageOfMaxLength = coverageOfMaxLength;
	}

	public void setN50(Integer n50) {
		this.n50 = n50;
	}
	public Integer getExpCov() {
		return expCov;
	}
	public void setExpCov(Integer expCov) {
		this.expCov = expCov;
	}
	public Integer getN50() {
		return n50;
	}

	public Integer getMaxLength() {
		return maxLength;
	}

	public void setMaxLength(Integer maxLength) {
		this.maxLength = maxLength;
	}

	public Long getTotalLength() {
		return totalLength;
	}
	public void setTotalLength(Long totalLength) {
		this.totalLength = totalLength;
	}
	
	public Integer getCoverageOfMaxLength() {
		return coverageOfMaxLength;
	}

	public void setCoverageOfMaxLength(Integer coverageOfMaxLength) {
		this.coverageOfMaxLength = coverageOfMaxLength;
	}

	public Integer getNContigs() {
		return nContigs;
	}

	public void setNContigs(Integer contigs) {
		nContigs = contigs;
	}

	public Integer getMinLength() {
		return minLength;
	}

	public void setMinLength(Integer minLength) {
		this.minLength = minLength;
	}

	public String toUserString(){
		StringBuilder sb = new StringBuilder();
		if(null != getMinLength()) sb.append("min=").append(getMinLength()).append("; ");
		if(null != getMaxLength()) sb.append("max=").append(getMaxLength()).append("; ");
		if(null != getN50()) sb.append("n50=").append(getN50()).append("; ");
		if(null != getTotalLength()) sb.append("total=").append(getTotalLength()).append("; ");
		if(null != getExpCov()) sb.append("expCov=").append(getExpCov()).append("; ");
		if(null != getCutoffCov()) sb.append("covCutoff=").append(getCutoffCov()).append("; ");
		if(null != getNContigs()) sb.append("nContigs=").append(getNContigs()).append("; ");
		return sb.toString();
	}
	
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,ToStringStyle.SHORT_PREFIX_STYLE);
	}
	public void setCutoffCov(Integer cutoffCov) {
		this.cutoffCov = cutoffCov;
	}
	public Integer getCutoffCov() {
		return cutoffCov;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((coverageOfMaxLength == null) ? 0 : coverageOfMaxLength
						.hashCode());
		result = prime * result
				+ ((cutoffCov == null) ? 0 : cutoffCov.hashCode());
		result = prime * result + ((expCov == null) ? 0 : expCov.hashCode());
		result = prime * result
				+ ((maxLength == null) ? 0 : maxLength.hashCode());
		result = prime * result + ((n50 == null) ? 0 : n50.hashCode());
		result = prime * result
				+ ((totalLength == null) ? 0 : totalLength.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		StatisticsInfo other = (StatisticsInfo) obj;
		if (coverageOfMaxLength == null) {
			if (other.coverageOfMaxLength != null)
				return false;
		} else if (!coverageOfMaxLength.equals(other.coverageOfMaxLength))
			return false;
		if (cutoffCov == null) {
			if (other.cutoffCov != null)
				return false;
		} else if (!cutoffCov.equals(other.cutoffCov))
			return false;
		if (expCov == null) {
			if (other.expCov != null)
				return false;
		} else if (!expCov.equals(other.expCov))
			return false;
		if (maxLength == null) {
			if (other.maxLength != null)
				return false;
		} else if (!maxLength.equals(other.maxLength))
			return false;
		if (n50 == null) {
			if (other.n50 != null)
				return false;
		} else if (!n50.equals(other.n50))
			return false;
		if (totalLength == null) {
			if (other.totalLength != null)
				return false;
		} else if (!totalLength.equals(other.totalLength))
			return false;
		return true;
	}

}
